<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>淘宝二维码关闭</title>
    <style>
        .box{
            position: relative;
            width: 74px;
            height: 88px;
            border: 1px solid #ccc;
            margin: 100px auto;
            font-size: 12px;
            text-align: center;
            color: #f40;

        }
        .box img{
            width: 60px;
            margin: 5px;

        }
        .close-btn{
            position: absolute;
            top: -1px;
            left: -16px;
            width: 14px;
            height: 14px;
            border: 1px solid #ccc;
            line-height: 14px;
            font-family: Arial, Helvetica, sans-serif;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <!-- 核心思路： 利用样式的显示和隐藏完成， display : none 隐藏元素 display : block 显示元素
              点击按钮 就让这个二维码盒子隐藏起来即可 -->


              <div class="box">
                  淘宝二维码
                  <img src="/qcy_20.gif" alt="">
                  <i class="close-btn">x</i>
              </div>
              <script>
                //   1 获取元素
                var box = document.querySelector('.box');
                var btn = document.querySelector('.close-btn');
                //   2 注册事件 处理程序
                btn.onclick = function(){
                    box.style.display = 'none';
                    
                }
              </script>
</body>
</html>